<?php
//1、连接mysql
$link=mysqli_connect("localhost","Shq","123456","2021learndb","3306") or exit("失败！".mysqli_connect_error());
//2、选择数据库(可省)
//mysqli_select_db("2021learndb");
//3、字符集
mysqli_set_charset($link,"utf8");
//4、建立操作表的字符串
$sql='SELECT * FROM `student`';
//5、获取结果集--对象
$result=mysqli_query($link,$sql);
//echo "<b><h1>xxx表</h1><b>";
//echo "<table border=\"2\">;
//echo "<tr><td>编号</td><td>姓名</td><td>年龄</td><td>";
//6、处理结果集
while($row=mysqli_fetch_assoc($result)){
//  echo "<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>";  
    print_r($row);
    echo "<br>";
}
//echo "</table>";